package cn.stylefeng.guns.modular.recy.utils;

import javax.servlet.http.*;
import cn.stylefeng.roses.core.xss.*;
import java.util.*;
import java.io.*;
import javax.servlet.*;

public class MyXssFilter extends XssFilter
{
    public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
        final HttpServletRequest httpServletRequest = (HttpServletRequest)request;
        final String servletPath = httpServletRequest.getServletPath();
        if (this.getUrlExclusion() != null) {
            boolean isExlusion = false;
            for (final String pattern : this.getUrlExclusion()) {
                isExlusion = (isExlusion || servletPath.matches(pattern));
                if (isExlusion) {
                    break;
                }
            }
            if (isExlusion) {
                chain.doFilter(request, response);
                return;
            }
        }
        chain.doFilter((ServletRequest)new XssHttpServletRequestWrapper((HttpServletRequest)request), response);
    }
}
